import { utilJavaApiParser } from './u_api_parser';
import { utilTemplate } from './u_template';
//@ts-ignore
const fs = require('fs');

(function () {
    try {

        const txt = fs.readFileSync('./data/java_api.json', 'utf8');
        const json = JSON.parse(txt);
        const list = utilJavaApiParser.parseSchemas(json, () => {
            return false;
        });
        // console.log('list', list.AddRequestWorkFlow.varList);
        // console.log(JSON.stringify(list, null, 2));
        fs.writeFileSync('./data/class.d.ts', utilTemplate.genInterface(list), 'utf8')

        const httpList = utilJavaApiParser.parsePaths(json);
        fs.writeFileSync('./data/http.d.ts', utilTemplate.genInterface(httpList), 'utf8')
    } catch (error) {
        console.log('err', error);
    }
})();
